using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace Rabbit3.Api.Models
{
    /// <summary>
    /// 免疫信息表
    /// </summary>
    [SugarTable("immunity_info")]
    public class ImmunityInfo
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        /// <summary>
        /// 养殖信息ID
        /// </summary>
        [SugarColumn(IsNullable = false)]
        [Required(ErrorMessage = "养殖信息ID不能为空")]
        public int FarmingInfoId { get; set; }

        /// <summary>
        /// 饲养天数
        /// </summary>
        [SugarColumn(IsNullable = false)]
        [Required(ErrorMessage = "饲养天数不能为空")]
        [Range(1, 99999, ErrorMessage = "饲养天数必须在1-99999之间")]
        public int FarmingDays { get; set; }

        /// <summary>
        /// 免疫方式
        /// </summary>
        [SugarColumn(ColumnDataType = "varchar(50)", IsNullable = false)]
        [Required(ErrorMessage = "免疫方式不能为空")]
        [StringLength(50, ErrorMessage = "免疫方式长度不能超过50个字符")]
        public string ImmunityMethod { get; set; } = string.Empty;

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime CreatedAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime UpdatedAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 是否删除
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public bool IsDeleted { get; set; } = false;

        /// <summary>
        /// 创建人ID
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int? CreatedBy { get; set; }

        /// <summary>
        /// 更新人ID
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int? UpdatedBy { get; set; }

        /// <summary>
        /// 导航属性 - 养殖信息
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public FarmingInfo? FarmingInfo { get; set; }
    }
}


